package com.fjec.user.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjec.common.protocol.JsonResult;
import com.fjec.user.entity.SysRole;
import com.fjec.user.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 003.角色表 前端控制器
 * </p>
 *
 * @author admin
 * @since 2020-08-31
 */
@RestController
@RequestMapping("/")
public class SysRoleController {

    @Autowired
    private ISysRoleService sysRoleServ;

    @PostMapping("/n/role/saveUserRole")
    public String saveUserRole(Long userId, String roleCode) {
        return sysRoleServ.saveUserRole(userId, roleCode);
    }

    @PostMapping("/y/role/save")
    public JsonResult saveRole(@RequestBody SysRole sysRole) {
        return sysRoleServ.saveRole(sysRole);
    }

    @GetMapping("/y/role/getPage")
    public JsonResult getRolesPage(Page page) {
        return sysRoleServ.getRolesPage(page);
    }
}
